﻿@{
    ViewBag.Title = "Edit";
    Layout = "~/Views/Shared/_AdminLayout.cshtml";
}

@section Header
{
    <script>
        function deleteArtwork(_id) {
            $.messager.confirm('确认', '确认删除?', function (r) {
                if (r) {
                    $.post("/ArtWork/DeleteArtWork/", { id: _id },
                      function (data, textStatus) {
                          if (data == 'success') {
                              window.location.reload();
                          }
                          else {
                              $.messager.alert('失败', data, 'error');
                          }
                      });
                }
            });
        }
    </script>
}


<body>
    <div>
        <table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
            @{
                IList<ArtWorkInfo> artworks = ViewData["ArtWork"] as List<ArtWorkInfo>;
                foreach (ArtWorkInfo item in artworks)
                {
                <tr>
                    <td width="500" style="border-bottom: 1px dashed #2894F6;"><a href="/ArtWork/Update?id=@item.ID">@item.ArtWorkName  </a>
                    </td>
                    <td width="50" style="border-bottom: 1px dashed #2894F6;">
                        <a href="#" onclick="deleteArtwork('@item.ID')">删除</a>
                    </td>
                    <td width="50" style="border-bottom: 1px dashed #2894F6;">
                        <a href="/ArtWork/Update?id=@item.ID">修改</a>
                    </td>
                </tr>
                }
            }
        </table>
        <p>
            @Html.Pager("pager", ViewData["pager"] as PagerInfo)
        </p>
    </div>
</body>
